package ByteStream;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class ByteStreamDemo8 {
        /**
         *
         * 利用try...cach...finally捕获拷贝文件中代码出现的异常
         */
        public static void main(String[] args) throws IOException {
            FileInputStream fos = new FileInputStream("E:\\Video\\当你有爱的超能力，你会不会使用超能力让对方爱上你.mp4");
            //计算时间
            long start = System.currentTimeMillis();

            FileOutputStream fos2 = new FileOutputStream("E:\\Education\\当你有爱的超能力，你会不会使用超能力让对方爱上你.mp4");
            int len = 0;
            byte[] bytes = new byte[1024*1024*5];

            while((len = fos.read(bytes)) != -1){
                fos2.write(bytes,0,len);
            }
            long end = System.currentTimeMillis();
            System.out.println(end - start);
            fos2.close();
            fos.close();
        }

}

